function EnumBase(list){
	var instance=this;
	this.list=list;
	this.display=function(k){
		for ( var i = 0; i < list.length; i++) {
			var vk = list[i];
			if(vk.v==k){
				return vk.t;
			}
		}
	}
	this.render=function(record,index,value){
		return instance.display(value);
	}
	this.rendSelect=function(elemtName,selectVal){
		var str="";
		$.each(list,function(i,item){
			str+="<option value='"+item.v+"'>"+item.t+"</option>"; 
       });
      $("[name="+elemtName+"]").append(str).val(selectVal);
       
	}
}

function servicelog(){
	//发送状态
	this.shipperStatus=new EnumBase([
								{v: '0', 	t:'已发送'},
								{v: '1', 	t:'接收成功'}
							]);
}

function customer(){
	//性别
	this.applysex=new EnumBase([
								{v: 'm', 	t:'男'},
								{v: 'f', 	t:'女'}
							]);
	//0:新增 1.取消 
	this.applytype=new EnumBase([
									{v: '0', 	t:'新增'},
									{v: '1', 	t:'取消 '}
								]); 
	//预约单状态 0:创建  1.成功 2.失败
	this.applystatus=new EnumBase([
									{v: '0', 	t:'创建'},
									{v: '1', 	t:'成功 '},
									{v: '2', 	t:'失败 '}
								]); 
	//来源:Phone|Net
	this.source=new EnumBase([
								{v: '0', 	t:'Phone'},
								{v: '1', 	t:'Net'}
							]);
}

//全局
function rmsEnum(){
	this.servicelog=new servicelog();
	this.customer=new customer();
	this.iniSelect=function(){
		$("select[enum]").each(function(){
			var o="rms_enum."+$(this).attr('enum')+".rendSelect('"
			o=o+this.name+"','"+$(this).attr("v")+"');";
			eval(o);
		});
	}
}
var rms_enum=new rmsEnum();

